//
//  GYZCityCollectionViewCell.m
//  Qyer
//
//  Created by GYz on 15/10/22.
//  Copyright © 2015年 GF. All rights reserved.
//

#import "GYZCityCollectionViewCell.h"
#define wid self.contentView.frame.size.width
#define hei self.contentView.frame.size.height
@implementation GYZCityCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor colorWithRed:248./255 green:248./255 blue:248./255 alpha:1];
        self.pic = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, wid, hei/2)];
        [self.contentView addSubview:self.pic];
        
        self.titleLab = [[UILabel alloc]initWithFrame:CGRectMake(0, hei/2, wid, hei/3)];
        self.titleLab.numberOfLines = 2;
        self.titleLab.font = [UIFont systemFontOfSize:14.];
        [self.contentView addSubview:self.titleLab];
        
        self.priceoffLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, self.titleLab.frame.size.height+hei/3*1.4 , wid/3, hei/6)];
        
        self.priceoffLabel.textColor = [UIColor grayColor];
        self.priceoffLabel.font = [UIFont systemFontOfSize:13.];
        [self.contentView addSubview:self.priceoffLabel];
        
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(wid/3*1.7, self.titleLab.frame.size.height+hei/3*1.4, wid/2, hei/6)];
        self.priceLabel.font = [UIFont systemFontOfSize:14.];
        self.priceLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:self.priceLabel];
        
    }
    return self;
}
- (void)setCityValueWithModel:(GYZCityModel *)model
{
    NSURL *url = [NSURL URLWithString:model.photo];
    
    [self.pic sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.titleLab.text = model.title;
    self.priceoffLabel.text = model.priceoff;
    NSString *str =[model.price substringWithRange:NSMakeRange(4, model.price.length - 4 - 7)];
    NSString *string = [NSString stringWithFormat:@"%@元起",str];
    self.priceLabel.text = string;
}
@end
